//
//  NewsTableViewCell.m
//  LOL_PalmarHelper
//
//  Created by dllo on 15/6/19.
//  Copyright (c) 2015年 hantao. All rights reserved.
//

#import "NewsTableViewCell.h"

@implementation NewsTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    
    return self;
    
    
    
}


-(void)createSubviews
{
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.origin.y+100, 5, [UIScreen mainScreen].bounds.size.width-100,45)];
  
    self.titleLabel.backgroundColor = [UIColor whiteColor];
    self.titleLabel.numberOfLines = 0;
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont systemFontOfSize:18.0];
    
    
    
    
    self.ViceTitleLabbel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleLabel.frame.origin.x , self.titleLabel.frame.size.height+self.titleLabel.frame.origin.y,[UIScreen mainScreen].bounds.size.width-100,45)];
    
    self.ViceTitleLabbel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.ViceTitleLabbel];
        self.ViceTitleLabbel.font = [UIFont systemFontOfSize:15.0];
    self.ViceTitleLabbel.textColor = [UIColor lightGrayColor];
    self.ViceTitleLabbel.numberOfLines = 0;
    
    
    
    
    self.NewsImage = [[UIImageView alloc] initWithFrame:CGRectMake(10,5,80,80)];
    self.NewsImage.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.NewsImage];
    
    
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10,self.NewsImage.frame.origin.y+self.NewsImage.frame.size.height+15,70,10)];
    self.timeLabel.backgroundColor = [UIColor whiteColor];
    self.timeLabel.text = @"发表时间: ";
    self.timeLabel.font = [UIFont systemFontOfSize:15.0];
    [self.contentView addSubview:self.timeLabel];
    
    
    self.timelabel2 = [[UILabel alloc] initWithFrame:CGRectMake(80,self.NewsImage.frame.origin.y+self.NewsImage.frame.size.height+10,  100, 20)];
    self.timelabel2.backgroundColor = [UIColor whiteColor];
    self.timelabel2.font = [UIFont systemFontOfSize:15.0];
    [self.contentView addSubview:self.timelabel2];
    
    
    
}

-(void)setNews:(NewsModel *)News
{
    if (_News != News) {
        [_News release];
        _News = [News retain];
    }
    self.titleLabel.text = self.News.title;
    self.ViceTitleLabbel.text = self.News.desc;
    self.timelabel2.text = self.News.posttime;
    NSURL *url = [NSURL URLWithString:_News.thumb_img];
    UIImage *image = [UIImage imageNamed:@"image.png"];
    [self.NewsImage sd_setImageWithURL:url placeholderImage:image];
    
}



















- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
